lib/fetcher-util: retry download on G_IO_ERROR_PARTIAL_INPUT
authorMatthew Leeds <matthew.leeds@endlessm.com>
Thu, 19 Mar 2020 22:28:08 +0000 (15:28 -0700)
committerMatthew Leeds <matthew.leeds@endlessm.com>
Thu, 19 Mar 2020 22:28:08 +0000 (15:28 -0700)
commit53d1efbaab03c089a8ae5fe52cd7a313595b6ff4
treee8fa2f0d46e997eae9ea2eeb51db5f2df7405a94
parentd0b3e76fa8409d7e50bec45e174eafd3efce31ab
lib/fetcher-util: retry download on G_IO_ERROR_PARTIAL_INPUT

Add G_IO_ERROR_PARTIAL_INPUT to the list of error codes caused by
transient networking errors which lead us to retry the request. When
attempting to install the spotify flatpak you often get the error
message "Connection terminated unexpectedly" and the download of the deb
file fails. In this case, libsoup is setting G_IO_ERROR_PARTIAL_INPUT
and sometimes a subsequent download attempt is successful, so we should
treat it as transient.

Ideally we would behave as wget does in this case and retry the download
picking up where we left off in the file rather than starting over, but
that would require changes to libsoup I think.

Sadly this patch does not fix the flatpak installation of spotify in the
face of such errors, because flatpak doesn't use libostree to download
extra data, but presumably it's possible we could encounter such an
error pulling from an ostree repo, so the patch is still correct.
src/libostree/ostree-fetcher-util.c